import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '*',
      redirect: '/'
    },{
      path: '/login',
      name: 'login',
      component: resolve => require(['@/view/Login'], resolve),
      meta: {
        title: '登录'
      }
    }, {
      path: '/register',
      name: 'register',
      component: resolve => require(['@/view/Reg'], resolve),
      meta: {
        title: '注册'
      }
    }, {
      path: '/',
      name: 'pageView',
      component: resolve => require(['@/view/PageView'], resolve),
      children: [
        {
          path: '/',
          redirect: '/home'
        }, {
          path: '/home',
          name: 'home',
          component: resolve => require(['@/view/Home'], resolve),
          meta: {
            title: '首页'
          }
        }, {
          path: '/creditService',
          name: 'creditService',
          component: resolve => require(['@/view/CreditService'], resolve),
          meta: {
            title: '债权服务'
          }
        }, {
          path: '/serviceDetail/:id',
          name: 'serviceDetail',
          component: resolve => require(['@/view/ServiceDetail'], resolve),
          meta: {
            title: '债权服务详情'
          }
        }, {
          path: '/creditService/charge',
          name: 'charge',
          component: resolve => require(['@/view/ChargeCredit'], resolve),
          meta: {
            title: '债权线索'
          }
        },
        {
          path: '/creditService/charge',
          name: 'charge',
          component: resolve => require(['@/view/ChargeCredit'], resolve),
          meta: {
            title: '债权交易'
          }
        },
        {
          path: '/creditService/post',
          name: 'post',
          component: resolve => require(['@/view/PostCredit'], resolve),
          meta: {
            title: '发布债权'
          }
        }, {
          path: '/laywerServic',
          name: 'laywerServic',
          component: resolve => require(['@/view/LaywerServic'], resolve),
          meta: {
            title: '律师服务'
          }
        }, {
          path: '/laywerDetail/:id',
          name: 'laywerDetail',
          component: resolve => require(['@/view/LaywerDetail'], resolve),
          meta: {
            title: '律师服务详情'
          }
        }, {
          path: '/case',
          name: 'case',
          component: resolve => require(['@/view/Case'], resolve),
          meta: {
            title: '案源委托'
          }
        }, {
          path: '/caseDetail/:id',
          name: 'caseDetail',
          component: resolve => require(['@/view/CaseDetail'], resolve),
          meta: {
            title: '案源详情'
          }
        }, {
          path: '/notice',
          name: 'companyintroduction',
          component: resolve => require(['@/view/Notice'], resolve),
          meta: {
            title: '公告咨询'
          }
        }, {
          path: '/noticeDetail/:id',
          name: 'noticeDetail',
          component: resolve => require(['@/view/NoticeDetail'], resolve),
          meta: {
            title: '公告详情'
          }
        }, {
          path: '/ask',
          name: 'ask',
          component: resolve => require(['@/view/Ask'], resolve),
          meta: {
            title: '交流问答'
          }
        }, {
          path: '/askDetail/:id',
          name: 'askDetail',
          component: resolve => require(['@/view/AskDetail'], resolve),
          meta: {
            title: '交流问答详情'
          }
        }, {
          path: '/aboutus',
          name: 'aboutus',
          component: resolve => require(['@/view/Aboutus'], resolve),
          meta: {
            title: '关于我们'
          }
        }, {
          path: '/laywerCenter',
          name: 'laywerCenter',
          component: resolve => require(['@/view/LaywerCenter'], resolve),
          meta: {
            title: '关于我们'
          }
        }, {
          path: '/user',
          name: 'user',
          component: resolve => require(['@/view/PageView'], resolve),
          meta: {
            title: '用户中心'
          },
          children: [{
            path: '/user/info',
            name: 'info',
            component: resolve => require(['@/view/user/Info'], resolve),
            meta: {
              title: '个人信息'
            }
          }, {
            path: '/user/credit',
            name: 'credit',
            component: resolve => require(['@/view/user/Credit'], resolve),
            meta: {
              title: '个人认证'
            }
          }, {
            path: '/user/my-credit',
            name: 'my-credit',
            component: resolve => require(['@/view/user/MyCredit'], resolve),
            meta: {
              title: '我的债权列表'
            }
          }, {
            path: '/user/my-trade',
            name: 'my-trade',
            component: resolve => require(['@/view/user/MyTrade'], resolve),
            meta: {
              title: '我的债权交易'
            }
          }, {
            path: '/user/golden-idea',
            name: 'golden-idea',
            component: resolve => require(['@/view/user/GoldenIdea'], resolve),
            meta: {
              title: '金点子服务'
            }
          }, {
            path: '/user/my-rank',
            name: 'my-rank',
            component: resolve => require(['@/view/user/MyRank'], resolve),
            meta: {
              title: '个人会员排行榜'
            }
          }, {
            path: '/user/my-wealth',
            name: 'my-wealth',
            component: resolve => require(['@/view/user/MyWealth'], resolve),
            meta: {
              title: '我的财富'
            }
          }]
        }
      ]
    }
  ]
})
